<?php if (!defined('THINK_PATH')) exit();?><html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta name="renderer" content="webkit">
    <title>登录</title>  
    <link rel="stylesheet" href="/Public/css/pintuer.css">
    <link rel="stylesheet" href="/Public/css/admin.css">
    <!-- <script src="/Public/js/jquery.js"></script> -->
    <!-- <script src="/Public/js/pintuer.js"></script>   -->
</head>
<body>
<div class="bg"></div>
<div class="container">
    <div class="line bouncein">
        <div class="xs6 xm4 xs3-move xm4-move">
            <div style="height:150px;"></div>
            <div class="media media-y margin-big-bottom">           
            </div>         
            <!-- <?php echo U('Admin/User/login');?> -->
            <form  id="req">
            <div class="panel loginbox">
                <div class="text-center margin-big padding-big-top"><h1>后台管理中心</h1></div>
                <div class="panel-body" style="padding:30px; padding-bottom:10px; padding-top:10px;">
                    <div class="form-group">
                        <div class="field field-icon-right">
                            <input type="text" class="input input-big"  name="mg_name" placeholder="请使用邮箱登录"  />
                            <span id="qqq"></span>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="field field-icon-right">
                            <input type="password" class="input input-big" name="mg_pwd" placeholder="登录密码"  />
                            <span id="www"></span>
                        </div>
                    </div>
                  <div class="form-group">
                        <div class="field">
                            <input type="text" id="rev" class="input input-big" name="yzm" placeholder="填写下侧的验证码"  />
                            <span><img id='imgsrc' src="<?php echo U('Admin/Manager/yzm');?>" style="cursor:pointer;"></span>
                            <div><span id="eee"></span></div>
                        <!--    <img src="/Public/images/passcode.jpg" alt="" width="100" height="32" class="passcode" style="height:43px;cursor:pointer;" onclick="this.src=this.src+'?'">   -->
                                                   
                        </div>
                    </div> 
                </div>
                <div id='bll' style="padding:30px;"><input type="button" class="button button-block bg-main text-big input-big" value="登录"></div>
            </div>
            </form>          
        </div>
    </div>
</div>
</body>
<script type="text/javascript" src="http://libs.baidu.com/jquery/1.8.2/jquery.min.js"></script>
<script>
    //验证提交form邮箱表单不能为空
    function yanzheng(){
        var osrc="<?php echo U('Admin/Manager/yzm');?>?="+Math.random();
        $('#imgsrc').attr('src',osrc);
    }
    $('#imgsrc').click(function(){
        yanzheng();
    });  
      
    $('#bll').click(function(){
            if($('input[name=mg_name]').val() == ""){
                    $('#qqq').html('<font color="red">用户名不能为空</font>');
                    return false;
               }else if($('input[name=mg_pwd]').val() == ""){
                    $('#www').html('<font color="red">密码不能为空</font>');
                    return false;
               }else if($('input[name=yzm]').val() == ""){
                    $('#eee').html('<font color="red">验证码不能为空</font>');
                    return false;
               }else{
                    var data = {
                        'mg_name':$('input[name="mg_name"]').val(),
                        'mg_pwd':$('input[name="mg_pwd"]').val(),
                        'yzm':$('input[name="yzm"]').val()
                        };
                        $.ajax({
                            // url:'/Admin/User/yzdl',
                            url:"<?php echo U('Admin/Manager/yzdl');?>",
                            type:'post',
                            data:data,
                            async:false,
                            success:function(res){
//                                 alert(res);
                               if(res == 2){
                                // alert('验证码错误');
                                $('#eee').html('<font color="red">验证码错误</font>');
                                yanzheng();
                                return false;
                               }else if(res == 3){
                                $('#www').html('<font color="red">用户名或者密码错误</font>');
                                // alert('用户名或者密码错误');
                                yanzheng();
                                return false;
                               }else{
                                window.location.href="<?php echo U('Admin/Index/index');?>";
                        }
                    }
                });
            }   
        });
  
        //     //验证邮箱格式
            $('input[name=mg_name]').blur(function(){

                 var att = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/
                     if(!att.test($('input[name=mg_name]').val() )){
                        $('#qqq').html('<font color="red">请填写正确格式邮箱</font>');
                            return false;
                    } else{
                        $('#qqq').html('');
                    }
        });   
        //     //验证密码不能为空
         $('input[name=mg_pwd]').blur(function(){
                              
                     if($('input[name=mg_pwd]').val() == ""){
                        $('#www').html('<font color="red">密码不能为空</font>');
                            return false;
                    } else{
                        $('#www').html('');
                    }
        });
        //        //验证密码不能为空
         $('input[name=yzm]').blur(function(){
                              
                     if($('input[name=yzm]').val() == ""){
                        $('#eee').html('<font color="red">验证码不能为空</font>');
                            return false;
                    } else{
                        $('#eee').html('');
                    }
        });                                          
        //验证用户名密码是否正确
        // $('#req').submit(function(){
        //     // alert('xxx');
        //     var data = {
        //         'email':$('input[name="email"]').val(),
        //         'password':$('input[name="password"]').val()
        //     }
        // $.post('/Amind/User/yz',data,function(res){
        //         alert(res);
        //     });
        // return false;
        // });
</script>
</html>